module.exports = class {
    constructor(flow) {
        this.$flow = flow;
        this.$linkMap = {}
        flow.$setting.link.map(item => item.split('>')).forEach(arr => {
            let from, line = '',
                to;
            if (arr.length == 2) {
                from = arr[0];
                to = arr[1];
            } else { //length =3
                from = arr[0];
                line = arr[1];
                to = arr[2];
            }
            this.$linkMap[from] = this.$linkMap[from] || {};
            this.$linkMap[from][line] = this.$linkMap[from][line] || [];
            this.$linkMap[from][line].push(to);
        })
    }
    $next(from = '', line = '') {
        if (this.$linkMap[from]) {
            return this.$linkMap[from][line] || [];
        }
        return []
    }
}
